package io.wmy.supex.modules.admin.controller;


import io.wmy.supex.framework.annotation.PrintLog;
import io.wmy.supex.modules.demo.model.User;
import io.wmy.supex.modules.demo.service.IUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;


@PrintLog(pretty = true)
@Controller
@RequestMapping("/admin")
public class AdminController {

    private static final Logger logger = LoggerFactory.getLogger(AdminController.class);

    @Resource
    private IUserService userService;


    @ResponseBody
    @RequestMapping(value = "/login", method = RequestMethod.POST)
    public User login(@PathVariable Integer id) {
        User user = userService.getUser(id);
        return user;
    }

    @RequestMapping(value = "/", method = RequestMethod.GET)
    public String index() {
        return "/admin/index";
    }
}
